package 设计模式.结构型.decorate装饰器.Demo_1.domain.Decorator;//package 设计模式.结构型.decorate装饰器.Demo_1.domain.Decorator;
//
//import 设计模式.结构型.decorate装饰器.Demo_1.Enum.PromotionType;
//import 设计模式.结构型.decorate装饰器.Demo_1.domain.OrderDetail;
//import 设计模式.结构型.decorate装饰器.Demo_1.domain.service.IBaseCount;
//
//import java.math.BigDecimal;
//
///**
// * 计算使用优惠券后的金额
// *
// * @author admin
// */
//public class CouponDecorator extends BaseCountDecorator {
//
//    public CouponDecorator(IBaseCount count) {
//        super(count);
//    }
//
//    public BigDecimal countPayMoney(OrderDetail orderDetail) {
//        BigDecimal payTotalMoney = new BigDecimal(0);
//        //原价
//        payTotalMoney = super.countPayMoney(orderDetail);
//        //使用优惠券
//        payTotalMoney = countCouponPayMoney(orderDetail);
//        return payTotalMoney;
//    }
//
//    private BigDecimal countCouponPayMoney(OrderDetail orderDetail) {
//
//        BigDecimal coupon = orderDetail.getMerchandise().getSupportPromotions().get(PromotionType.COUPON).getUserCoupon().getCoupon();
//        System.out.println("优惠券金额：" + coupon);
//
//        orderDetail.setPayMoney(orderDetail.getPayMoney().subtract(coupon));
//        return orderDetail.getPayMoney();
//    }
//}